<?php


namespace App\Http\Service\frontend;

use App\Common\Utils\Common;
use App\Http\Models\Rotation\Rotation;

class RotationService
{
    const NUMBER = 5;

    public function index()
    {
        $rotationDatas = Rotation::select()->limit(self::NUMBER)->orderBy('sort', 'desc')->orderBy('created_at', 'desc')->get()->toArray();
        array_walk($rotationDatas,function(&$val){
            $val['images']=Common::getHost().$val['images'];
            $val['created_at']=date('Y-m-d H:i:s',$val['created_at']);
        });
        return $rotationDatas;
    }
}
